﻿// See https://aka.ms/new-console-template for more information
using System.Collections.Generic;
using System;
using System.Linq;
namespace MyNamespace
{


    public class MyClass
    {
         public static void  Main(string[] strings)
        {
            P1Solution();
            //P2Solution();
        }



        public static void  P1Solution()
        {
            int[] record = new int[10000000];
            int taskNum = Convert.ToInt32(Console.ReadLine());
            int last = 0;
            for (int i = 0; i < taskNum; i++)
            {
                string[] items = Console.ReadLine().Split(' ');
                int a = Convert.ToInt32(items[0].Last());
                int b = Convert.ToInt32(items[1].Last());
                last = Math.Max(b, last);
                record[a]++;
                record[b+1]--;
            }
            int index = 0;
            while (record[index] == 0) index++;
            int status = 0;
            int ans = 0;
            for (int i = index; i <= last; i++)
            {
               
                status += record[i];
                Console.WriteLine("status{0}", status);
                if (status == 1) ans += 3;
                else if(status>1)ans += 4;
                else ans += 1;
                Console.WriteLine(ans);

            }
            //Console.WriteLine(ans);
        }



        public static IDictionary<int, IList<int>> record = new Dictionary<int, IList<int>>(); /* 建立字典型树，不一定是二叉所以用数组*/
        public static HashSet<int> barrRecord = new HashSet<int>(); /* 建立障碍物哈希表*/
        public static string minPath = null; /* 维护最小路径*/
        /// <summary>
        /// 先沿途遍历找到所有叶子节点，再根据障碍物剔除路径。再比较最短输出
        /// </summary>
        public  static void P2Solution()
        {
          
            //读取节点数目
            int nodesNum = Convert.ToInt32(Console.ReadLine());
            //读取边数目
            int edgesNum = Convert.ToInt32(Console.ReadLine());
            //根据edge构造树
            for(int i = 0; i < edgesNum; i++) {
                string []items = Console.ReadLine().Split(' ');
                int a = Convert.ToInt32(items[0]);
                int b = Convert.ToInt32(items[1]);
                if (!record.ContainsKey(a))  record.TryAdd(a, new List<int> { b });
                else record[a].Add(b);
             
            }
            //读取障碍点数目
            int barrNum  = Convert.ToInt32(Console.ReadLine());
            //读取障碍点
            for (int i = 0; i < barrNum; i++){
                int a = Convert.ToInt32(Console.ReadLine());
                barrRecord.Add(a);
            }
            //输入结束，开始遍历
            Travel(0,"0");
            Console.Write(minPath.First());
            for(int i = 1; i < minPath.Length; i++){
                Console.Write("->{0}", minPath[i]);
            }
            
        }
        public static void Travel(int loc, string path)
        {
            //遇到障碍物直接返回
            if (barrRecord.Contains(loc)) return; 
            //找到叶子节点
            if (!record.ContainsKey(loc))
            {
                //找到叶子节点(字典结构中无该节点后继者记录),更新
                if (minPath == null) minPath = path;
                else
                {
                    //利用字符串比较方法
                    if (minPath.CompareTo(path) > 0)
                    {
                        minPath = path;
                    }
                }
            }
            else
            {
                //从后继节点继续访问
                foreach(var node in record[loc])
                {
                    Travel(node, path + node);
                }
            }
        }
    }
}
